-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #15206: Handling keept_output and asynchronous parameters in the remote-run API #2302
Fixes #15206: Handling keept_output and asynchronous parameters in the remote-run API #2302
Conversation
@@ -65,6 +65,20 @@ impl RemoteRun { | |||
}) | |||
} | |||
|
|||
pub fn reply_keep_output(&self, job_config: Arc<JobConfig>) -> impl warp::reply::Reply | |||
{ | |||
if self.run_parameters.keep_output == true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to explicitely compare to true
, cargo clippy
would likely mention it
Commit modified |
1 similar comment
Commit modified |
@@ -65,32 +65,66 @@ impl RemoteRun { | |||
}) | |||
} | |||
|
|||
pub fn target_to_vector(&self, job_config: Arc<JobConfig>) -> Vec<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a method of RemoteRunTarget, called get_connected_nodes
or something like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vector is a technical implementation detail, you should strive to use applicative business names as much as possible to keep things readable
return Err(warp::reject::custom( | ||
"keep_output and asynchronous cannot be true simultaneously", | ||
)); | ||
} | ||
if self.target == RemoteRunTarget::All { | ||
info!("conditions OK"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is probably useless, if there is no error we can assume parameters were correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up
Commit modified |
1 similar comment
Commit modified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/fake_agent.sh is missing from this PR
@@ -221,8 +250,33 @@ impl RunParameters { | |||
.map_err(|e| panic!("error while running child: {}", e)); | |||
|
|||
tokio::spawn(child_future); | |||
//thread::sleep(time::Duration::from_millis(500)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover from a test
@@ -47,4 +47,36 @@ mod tests { | |||
|
|||
assert_eq!(res.unwrap().text().unwrap(), "Unhandled rejection: Invalid agent Condition : Invalid agent Condition : Wrong condition: \'clas~1\', it should match ^[a-zA-Z0-9][a-zA-Z0-9_]*$".to_string()); | |||
} | |||
|
|||
#[test] | |||
fn integration() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you give it a more descriptive name?
Commit modified |
PR rebased |
relay/sources/relayd/api_test.txt
Outdated
@@ -0,0 +1 @@ | |||
remote run -D class2,class3 -H server.rudder.local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the result of the test, it should not be included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Furthermore, temporary files created by tests should go into target/tmp
@@ -0,0 +1 @@ | |||
hello moto la |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
Commit modified |
1 similar comment
Commit modified |
.form(¶ms) | ||
.send(); | ||
|
||
let data = std::fs::read_to_string("./api_test.txt").expect("Unable to read file"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path needs to be updated
Commit modified |
2 similar comments
Commit modified |
Commit modified |
Commit modified |
OK, merging this PR |
https://issues.rudder.io/issues/15206